package com.zr.controller;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.zr.model.Department;
import com.zr.service.DepartmentService;

public class SelectOneDepartmentController extends HttpServlet{
	DepartmentService deps=new DepartmentService(); 
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(req, resp);
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		String did=req.getParameter("did");
		resp.setCharacterEncoding("utf8");
		PrintWriter  pw  = resp.getWriter();
		//将拿到的数据以jSONObject格式写回去
		pw.write(deps.selectOneDepById(Integer.parseInt(did.trim())).toString());
	}
}
